package FindCharNum;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Test;

/**
 * @author Jiang Zhiyan
 *
 * 2021年6月29日 上午9:38:38
 *
 */
public class JudgeChar {
//	@Test
//     public void judgeChar() {
//    	 Scanner sc = new Scanner(System.in);
//    	  String str=sc.nextLine();
//    	  ArrayList<Counter> a1 = new ArrayList<Counter>();
//    	Counter count= new Counter();
//    	 for(int i=0;i<str.length();i++) {
//    		 char c= str.charAt(i);
//    		 if(c.)
//    	 }}
	
	public void MapTest() {
		 Map<Character,Integer> map = new HashMap<Character,Integer>();
		 for(int i=0;i<info.length(i++);
	}[]
	
	public void counter(String data) {
		List<Counter> list = new ArrayList<Counter>();
		for(int i=0;i<data.length();i++) {
			char c= data.charAt(i);
			//实例化一个对象
			Counter entry = new Counter(c,1);
			if(list.contains(entry)) {
				int index= list.indexOf(entry);
				Counter cun = list.get(index);
				cun.setNum(cun.getNum()+1);
			}else {
				list.add(entry);
			}
		}
		System.out.println(list);
	}
     @Test
	public void testCounter() {
		String info="ssebgdsaasss";
		counter(info);
	}
}
